package priv.liaohaolong.fullstacktest.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import priv.liaohaolong.fullstacktest.dao.BookMapper;
import priv.liaohaolong.fullstacktest.modal.BookDO;
import priv.liaohaolong.fullstacktest.service.BookService;

@Service
public class BookServiceImpl implements BookService {

    private final BookMapper bookMapper;

    @Autowired
    public BookServiceImpl(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    @Override
    public IPage<BookDO> page(int page, int size) {
        // 分页查询
        Page<BookDO> doPage = new Page<>(page, size);
        return bookMapper.selectPage(doPage, null);
    }
}
